// Copyright (C) 1953-2022 NUDT
// Verilog module name - measure_response.v
// Version: V4.1.0.20221208
// Created:
//         by - fenglin
////////////////////////////////////////////////////////////////////////////
// Description:
//         
///////////////////////////////////////////////////////////////////////////

`timescale 1ns/1ps

module measure_response#(parameter local_module_id = 12'd0)
(
	i_clk              ,
	i_rst_n            ,
	
	iv_hcp_mid     ,
	
	iv_data        ,
	i_data_wr	   ,
	
	iv_mea_clk     ,

	ov_data        ,
	o_data_wr      ,
	
	i_osm_req_rx_pulse_p0  ,
	i_osm_resp_tx_pulse_p0 ,
	i_osm_req_rx_pulse_p1  ,
	i_osm_resp_tx_pulse_p1 ,
	i_osm_req_rx_pulse_p2  ,
	i_osm_resp_tx_pulse_p2 ,
	i_osm_req_rx_pulse_p3  ,
	i_osm_resp_tx_pulse_p3 ,
	i_osm_req_rx_pulse_p4  ,
	i_osm_resp_tx_pulse_p4 ,
	i_osm_req_rx_pulse_p5  ,
	i_osm_resp_tx_pulse_p5 ,
	i_osm_req_rx_pulse_p6  ,
	i_osm_resp_tx_pulse_p6 ,
	i_osm_req_rx_pulse_p7  ,
	i_osm_resp_tx_pulse_p7 ,
	i_osm_req_rx_pulse_p8  ,
	i_osm_resp_tx_pulse_p8 ,
	i_osm_req_rx_pulse_p9  ,
	i_osm_resp_tx_pulse_p9 ,
	i_osm_req_rx_pulse_p10 ,
	i_osm_resp_tx_pulse_p10,
	i_osm_req_rx_pulse_p11 ,
	i_osm_resp_tx_pulse_p11,
	i_osm_req_rx_pulse_p12 ,
	i_osm_resp_tx_pulse_p12,
	i_osm_req_rx_pulse_p13 ,
	i_osm_resp_tx_pulse_p13,
	i_osm_req_rx_pulse_p14 ,
	i_osm_resp_tx_pulse_p14,
	i_osm_req_rx_pulse_p15 ,
	i_osm_resp_tx_pulse_p15,
	i_osm_req_rx_pulse_p16 ,
	i_osm_resp_tx_pulse_p16,
	i_osm_req_rx_pulse_p17 ,
	i_osm_resp_tx_pulse_p17,
	i_osm_req_rx_pulse_p18 ,
	i_osm_resp_tx_pulse_p18,
	i_osm_req_rx_pulse_p19 ,
	i_osm_resp_tx_pulse_p19,
	i_osm_req_rx_pulse_p20 ,
	i_osm_resp_tx_pulse_p20,
	i_osm_req_rx_pulse_p21 ,
	i_osm_resp_tx_pulse_p21,
	i_osm_req_rx_pulse_p22 ,
	i_osm_resp_tx_pulse_p22,
	i_osm_req_rx_pulse_p23 ,
	i_osm_resp_tx_pulse_p23,
	i_osm_req_rx_pulse_p24 ,
	i_osm_resp_tx_pulse_p24,
	i_osm_req_rx_pulse_p25 ,
	i_osm_resp_tx_pulse_p25,
	i_osm_req_rx_pulse_p26 ,
	i_osm_resp_tx_pulse_p26,
	i_osm_req_rx_pulse_p27 ,
	i_osm_resp_tx_pulse_p27,
	i_osm_req_rx_pulse_p28 ,
	i_osm_resp_tx_pulse_p28,
	i_osm_req_rx_pulse_p29 ,
	i_osm_resp_tx_pulse_p29,
	i_osm_req_rx_pulse_p30 ,
	i_osm_resp_tx_pulse_p30,
	i_osm_req_rx_pulse_p31 ,
	i_osm_resp_tx_pulse_p31
	
); 
// I/O
// clk & rst
input                  i_clk            ;
input                  i_rst_n          ; 
// pkt input
input      [8:0]	   iv_data          ;
input     	           i_data_wr        ;

input      [11:0]      iv_hcp_mid       ;
input      [79:0]      iv_mea_clk       ;

output     [8:0]	   ov_data          ;
output    	           o_data_wr        ;

input                  i_osm_req_rx_pulse_p0   ;
input                  i_osm_resp_tx_pulse_p0  ;
input                  i_osm_req_rx_pulse_p1   ;
input                  i_osm_resp_tx_pulse_p1  ;
input                  i_osm_req_rx_pulse_p2   ;
input                  i_osm_resp_tx_pulse_p2  ;
input                  i_osm_req_rx_pulse_p3   ;
input                  i_osm_resp_tx_pulse_p3  ;
input                  i_osm_req_rx_pulse_p4   ;
input                  i_osm_resp_tx_pulse_p4  ;
input                  i_osm_req_rx_pulse_p5   ;
input                  i_osm_resp_tx_pulse_p5  ;
input                  i_osm_req_rx_pulse_p6   ;
input                  i_osm_resp_tx_pulse_p6  ;
input                  i_osm_req_rx_pulse_p7   ;
input                  i_osm_resp_tx_pulse_p7  ;
input                  i_osm_req_rx_pulse_p8   ;
input                  i_osm_resp_tx_pulse_p8  ;
input                  i_osm_req_rx_pulse_p9   ;
input                  i_osm_resp_tx_pulse_p9  ;
input                  i_osm_req_rx_pulse_p10  ;
input                  i_osm_resp_tx_pulse_p10 ;
input                  i_osm_req_rx_pulse_p11  ;
input                  i_osm_resp_tx_pulse_p11 ;
input                  i_osm_req_rx_pulse_p12  ;
input                  i_osm_resp_tx_pulse_p12 ;
input                  i_osm_req_rx_pulse_p13  ;
input                  i_osm_resp_tx_pulse_p13 ;
input                  i_osm_req_rx_pulse_p14  ;
input                  i_osm_resp_tx_pulse_p14 ;
input                  i_osm_req_rx_pulse_p15  ;
input                  i_osm_resp_tx_pulse_p15 ;
input                  i_osm_req_rx_pulse_p16  ;
input                  i_osm_resp_tx_pulse_p16 ;
input                  i_osm_req_rx_pulse_p17  ;
input                  i_osm_resp_tx_pulse_p17 ;
input                  i_osm_req_rx_pulse_p18  ;
input                  i_osm_resp_tx_pulse_p18 ;
input                  i_osm_req_rx_pulse_p19  ;
input                  i_osm_resp_tx_pulse_p19 ;
input                  i_osm_req_rx_pulse_p20  ;
input                  i_osm_resp_tx_pulse_p20 ;
input                  i_osm_req_rx_pulse_p21  ;
input                  i_osm_resp_tx_pulse_p21 ;
input                  i_osm_req_rx_pulse_p22  ;
input                  i_osm_resp_tx_pulse_p22 ;
input                  i_osm_req_rx_pulse_p23  ;
input                  i_osm_resp_tx_pulse_p23 ;
input                  i_osm_req_rx_pulse_p24  ;
input                  i_osm_resp_tx_pulse_p24 ;
input                  i_osm_req_rx_pulse_p25  ;
input                  i_osm_resp_tx_pulse_p25 ;
input                  i_osm_req_rx_pulse_p26  ;
input                  i_osm_resp_tx_pulse_p26 ;
input                  i_osm_req_rx_pulse_p27  ;
input                  i_osm_resp_tx_pulse_p27 ;
input                  i_osm_req_rx_pulse_p28  ;
input                  i_osm_resp_tx_pulse_p28 ;
input                  i_osm_req_rx_pulse_p29  ;
input                  i_osm_resp_tx_pulse_p29 ;
input                  i_osm_req_rx_pulse_p30  ;
input                  i_osm_resp_tx_pulse_p30 ;
input                  i_osm_req_rx_pulse_p31  ;
input                  i_osm_resp_tx_pulse_p31 ;
					   
wire                   w_fifo_empty_fifo2prr  ;
wire            	   w_fifo_rden_prr2fifo   ;
wire       [8:0] 	   wv_fifo_rdata_fifo2prr ;
wire       [11:0] 	   wv_fifo_usedw_fifo2prr ;

wire                   w_data_ready_rrg2prr   ;

wire       [8:0]       wv_data_prr2opd ;
wire                   w_dta_wr_prr2opd;

wire       [7:0]       wv_osm_id_opd2rrg ;
wire       [8:0]       wv_data_opd2rrg   ;
wire                   w_data_wr_opd2rrg ;

wire       [7:0]       wv_osm_id_rrg2ope ;
wire       [8:0]       wv_data_rrg2ope   ;
wire                   w_data_wr_rrg2ope ;
wire       [3:0]       wv_ptp_messagetype_rrg2ope;
wire                   w_first_byte_valid_rrg2ope;

wire       [79:0]	   wv_t2_p0_rtr2rrg            ;
wire       [79:0]	   wv_t2_p1_rtr2rrg            ;
wire       [79:0]	   wv_t2_p2_rtr2rrg            ;
wire       [79:0]	   wv_t2_p3_rtr2rrg            ;
wire       [79:0]	   wv_t2_p4_rtr2rrg            ;
wire       [79:0]	   wv_t2_p5_rtr2rrg            ;
wire       [79:0]	   wv_t2_p6_rtr2rrg            ;      
wire       [79:0]	   wv_t2_p7_rtr2rrg            ;
wire       [79:0]	   wv_t2_p8_rtr2rrg            ;
wire       [79:0]	   wv_t2_p9_rtr2rrg            ;
wire       [79:0]	   wv_t2_p10_rtr2rrg           ;
wire       [79:0]	   wv_t2_p11_rtr2rrg           ;
wire       [79:0]	   wv_t2_p12_rtr2rrg           ;
wire       [79:0]	   wv_t2_p13_rtr2rrg           ;
wire       [79:0]	   wv_t2_p14_rtr2rrg           ;
wire       [79:0]	   wv_t2_p15_rtr2rrg           ;
wire       [79:0]	   wv_t2_p16_rtr2rrg           ;
wire       [79:0]	   wv_t2_p17_rtr2rrg           ;
wire       [79:0]	   wv_t2_p18_rtr2rrg           ;
wire       [79:0]	   wv_t2_p19_rtr2rrg           ;
wire       [79:0]	   wv_t2_p20_rtr2rrg           ;
wire       [79:0]	   wv_t2_p21_rtr2rrg           ;
wire       [79:0]	   wv_t2_p22_rtr2rrg           ;
wire       [79:0]	   wv_t2_p23_rtr2rrg           ;
wire       [79:0]	   wv_t2_p24_rtr2rrg           ;
wire       [79:0]	   wv_t2_p25_rtr2rrg           ;
wire       [79:0]	   wv_t2_p26_rtr2rrg           ;
wire       [79:0]	   wv_t2_p27_rtr2rrg           ;
wire       [79:0]	   wv_t2_p28_rtr2rrg           ;
wire       [79:0]	   wv_t2_p29_rtr2rrg           ;
wire       [79:0]	   wv_t2_p30_rtr2rrg           ;
wire       [79:0]	   wv_t2_p31_rtr2rrg           ;

wire       [79:0]      wv_t3_rtr2rrg               ;
wire                   w_t3_wr_rtr2rrg             ;

response_timestamps_record  response_timestamps_record_inst
(
        .i_clk                  (i_clk  ),
        .i_rst_n                (i_rst_n),
		 
        .iv_mea_clk         	(iv_mea_clk),
		 
		.i_osm_req_rx_pulse_p0  (i_osm_req_rx_pulse_p0  ),
		.i_osm_resp_tx_pulse_p0 (i_osm_resp_tx_pulse_p0 ),
		.i_osm_req_rx_pulse_p1  (i_osm_req_rx_pulse_p1  ),
		.i_osm_resp_tx_pulse_p1 (i_osm_resp_tx_pulse_p1 ),
		.i_osm_req_rx_pulse_p2  (i_osm_req_rx_pulse_p2  ),
		.i_osm_resp_tx_pulse_p2 (i_osm_resp_tx_pulse_p2 ),
		.i_osm_req_rx_pulse_p3  (i_osm_req_rx_pulse_p3  ),
		.i_osm_resp_tx_pulse_p3 (i_osm_resp_tx_pulse_p3 ),
		.i_osm_req_rx_pulse_p4  (i_osm_req_rx_pulse_p4  ),
		.i_osm_resp_tx_pulse_p4 (i_osm_resp_tx_pulse_p4 ),
		.i_osm_req_rx_pulse_p5  (i_osm_req_rx_pulse_p5  ),
		.i_osm_resp_tx_pulse_p5 (i_osm_resp_tx_pulse_p5 ),
		.i_osm_req_rx_pulse_p6  (i_osm_req_rx_pulse_p6  ),
		.i_osm_resp_tx_pulse_p6 (i_osm_resp_tx_pulse_p6 ),
		.i_osm_req_rx_pulse_p7  (i_osm_req_rx_pulse_p7  ),
		.i_osm_resp_tx_pulse_p7 (i_osm_resp_tx_pulse_p7 ),
		.i_osm_req_rx_pulse_p8  (i_osm_req_rx_pulse_p8  ),
		.i_osm_resp_tx_pulse_p8 (i_osm_resp_tx_pulse_p8 ),
		.i_osm_req_rx_pulse_p9  (i_osm_req_rx_pulse_p9  ),
		.i_osm_resp_tx_pulse_p9 (i_osm_resp_tx_pulse_p9 ),
		.i_osm_req_rx_pulse_p10 (i_osm_req_rx_pulse_p10 ),
		.i_osm_resp_tx_pulse_p10(i_osm_resp_tx_pulse_p10),
		.i_osm_req_rx_pulse_p11 (i_osm_req_rx_pulse_p11 ),
		.i_osm_resp_tx_pulse_p11(i_osm_resp_tx_pulse_p11),
		.i_osm_req_rx_pulse_p12 (i_osm_req_rx_pulse_p12 ),
		.i_osm_resp_tx_pulse_p12(i_osm_resp_tx_pulse_p12),
		.i_osm_req_rx_pulse_p13 (i_osm_req_rx_pulse_p13 ),
		.i_osm_resp_tx_pulse_p13(i_osm_resp_tx_pulse_p13),
		.i_osm_req_rx_pulse_p14 (i_osm_req_rx_pulse_p14 ),
		.i_osm_resp_tx_pulse_p14(i_osm_resp_tx_pulse_p14),
		.i_osm_req_rx_pulse_p15 (i_osm_req_rx_pulse_p15 ),
		.i_osm_resp_tx_pulse_p15(i_osm_resp_tx_pulse_p15),
		.i_osm_req_rx_pulse_p16 (i_osm_req_rx_pulse_p16 ),
		.i_osm_resp_tx_pulse_p16(i_osm_resp_tx_pulse_p16),
		.i_osm_req_rx_pulse_p17 (i_osm_req_rx_pulse_p17 ),
		.i_osm_resp_tx_pulse_p17(i_osm_resp_tx_pulse_p17),
		.i_osm_req_rx_pulse_p18 (i_osm_req_rx_pulse_p18 ),
		.i_osm_resp_tx_pulse_p18(i_osm_resp_tx_pulse_p18),
		.i_osm_req_rx_pulse_p19 (i_osm_req_rx_pulse_p19 ),
		.i_osm_resp_tx_pulse_p19(i_osm_resp_tx_pulse_p19),
		.i_osm_req_rx_pulse_p20 (i_osm_req_rx_pulse_p20 ),
		.i_osm_resp_tx_pulse_p20(i_osm_resp_tx_pulse_p20),
		.i_osm_req_rx_pulse_p21 (i_osm_req_rx_pulse_p21 ),
		.i_osm_resp_tx_pulse_p21(i_osm_resp_tx_pulse_p21),
		.i_osm_req_rx_pulse_p22 (i_osm_req_rx_pulse_p22 ),
		.i_osm_resp_tx_pulse_p22(i_osm_resp_tx_pulse_p22),
		.i_osm_req_rx_pulse_p23 (i_osm_req_rx_pulse_p23 ),
		.i_osm_resp_tx_pulse_p23(i_osm_resp_tx_pulse_p23),
		.i_osm_req_rx_pulse_p24 (i_osm_req_rx_pulse_p24 ),
		.i_osm_resp_tx_pulse_p24(i_osm_resp_tx_pulse_p24),
		.i_osm_req_rx_pulse_p25 (i_osm_req_rx_pulse_p25 ),
		.i_osm_resp_tx_pulse_p25(i_osm_resp_tx_pulse_p25),
		.i_osm_req_rx_pulse_p26 (i_osm_req_rx_pulse_p26 ),
		.i_osm_resp_tx_pulse_p26(i_osm_resp_tx_pulse_p26),
		.i_osm_req_rx_pulse_p27 (i_osm_req_rx_pulse_p27 ),
		.i_osm_resp_tx_pulse_p27(i_osm_resp_tx_pulse_p27),
		.i_osm_req_rx_pulse_p28 (i_osm_req_rx_pulse_p28 ),
		.i_osm_resp_tx_pulse_p28(i_osm_resp_tx_pulse_p28),
		.i_osm_req_rx_pulse_p29 (i_osm_req_rx_pulse_p29 ),
		.i_osm_resp_tx_pulse_p29(i_osm_resp_tx_pulse_p29),
		.i_osm_req_rx_pulse_p30 (i_osm_req_rx_pulse_p30 ),
		.i_osm_resp_tx_pulse_p30(i_osm_resp_tx_pulse_p30),
		.i_osm_req_rx_pulse_p31 (i_osm_req_rx_pulse_p31 ),
		.i_osm_resp_tx_pulse_p31(i_osm_resp_tx_pulse_p31),
 
        .ov_t2_p0                  (wv_t2_p0_rtr2rrg  ),					
        .ov_t2_p1                  (wv_t2_p1_rtr2rrg  ),	
        .ov_t2_p2                  (wv_t2_p2_rtr2rrg  ),	
        .ov_t2_p3                  (wv_t2_p3_rtr2rrg  ),	
        .ov_t2_p4                  (wv_t2_p4_rtr2rrg  ),	
        .ov_t2_p5                  (wv_t2_p5_rtr2rrg  ),	
        .ov_t2_p6                  (wv_t2_p6_rtr2rrg  ),	
        .ov_t2_p7                  (wv_t2_p7_rtr2rrg  ),	
        .ov_t2_p8                  (wv_t2_p8_rtr2rrg  ),
        .ov_t2_p9                  (wv_t2_p9_rtr2rrg  ),
        .ov_t2_p10                 (wv_t2_p10_rtr2rrg ) ,
        .ov_t2_p11                 (wv_t2_p11_rtr2rrg ) ,
        .ov_t2_p12                 (wv_t2_p12_rtr2rrg ) ,
        .ov_t2_p13                 (wv_t2_p13_rtr2rrg ) ,
        .ov_t2_p14                 (wv_t2_p14_rtr2rrg ) ,
        .ov_t2_p15                 (wv_t2_p15_rtr2rrg ) ,
        .ov_t2_p16                 (wv_t2_p16_rtr2rrg ) ,
        .ov_t2_p17                 (wv_t2_p17_rtr2rrg ) ,
        .ov_t2_p18                 (wv_t2_p18_rtr2rrg ) ,
        .ov_t2_p19                 (wv_t2_p19_rtr2rrg ) ,
        .ov_t2_p20                 (wv_t2_p20_rtr2rrg ) ,
        .ov_t2_p21                 (wv_t2_p21_rtr2rrg ) ,
        .ov_t2_p22                 (wv_t2_p22_rtr2rrg ) ,
        .ov_t2_p23                 (wv_t2_p23_rtr2rrg ) ,
        .ov_t2_p24                 (wv_t2_p24_rtr2rrg ) ,
        .ov_t2_p25                 (wv_t2_p25_rtr2rrg ) ,	
        .ov_t2_p26                 (wv_t2_p26_rtr2rrg ) ,
        .ov_t2_p27                 (wv_t2_p27_rtr2rrg ) ,
        .ov_t2_p28                 (wv_t2_p28_rtr2rrg ) ,
        .ov_t2_p29                 (wv_t2_p29_rtr2rrg ) ,
        .ov_t2_p30                 (wv_t2_p30_rtr2rrg ) ,
        .ov_t2_p31                 (wv_t2_p31_rtr2rrg ) ,
		                            
        .ov_t3                     (wv_t3_rtr2rrg     ) ,				
		.o_t3_valid                (w_t3_wr_rtr2rrg   )
);    
syncfifo_showahead_aclr_w9d4096 pdelay_req_buffer_inst(
    .data  (iv_data), 
    .wrreq (i_data_wr),
    .rdreq (w_fifo_rden_prr2fifo),
    .clock (i_clk),
    .aclr  (!i_rst_n), 
    .q     (wv_fifo_rdata_fifo2prr),    
    .usedw (wv_fifo_usedw_fifo2prr),
    .full  (), 
    .empty (w_fifo_empty_fifo2prr) 
);
pdelay_req_read pdelay_req_read_inst
(
	.i_clk              (i_clk   ),
	.i_rst_n            (i_rst_n ),
		 
	.i_fifo_empty       (w_fifo_empty_fifo2prr ),
	.o_fifo_rden        (w_fifo_rden_prr2fifo  ),
	.iv_fifo_rdata      (wv_fifo_rdata_fifo2prr),
			 
	.i_data_ready       (w_data_ready_rrg2prr),
	.ov_data            (wv_data_prr2opd ),
	.o_data_wr          (w_dta_wr_prr2opd)
); 

opensync_protocol_decapsulate opensync_protocol_decapsulate_inst
(
        .i_clk              (i_clk                   ),
        .i_rst_n            (i_rst_n                 ),
                                                     
        .iv_data            (wv_data_prr2opd           ),
        .i_data_wr          (w_dta_wr_prr2opd          ),
         
        .ov_local_cnt_rx    ( ),
        .ov_eth_type        (    ), 
        .ov_tsmp_type       (   ),
        .ov_tsmp_subtype    (),
		.ov_osm_id          (wv_osm_id_opd2rrg    ),                
        .ov_data            (wv_data_opd2rrg      ),
		.o_data_wr          (w_data_wr_opd2rrg    )
    );
	
responder_response_generate #(.local_module_id(local_module_id))responder_response_generate_inst
(
    .i_clk                                 (i_clk     ),
    .i_rst_n                               (i_rst_n   ),
	 
	.iv_hcp_mid                            (iv_hcp_mid),
   
    .iv_data                               (wv_data_opd2rrg  ),
	.i_data_wr                             (w_data_wr_opd2rrg),
	.iv_port_id                            (wv_osm_id_opd2rrg),
	 
	.o_data_ready                          (w_data_ready_rrg2prr),	
	 
	.ov_data                               (wv_data_rrg2ope  ),
	.o_data_wr                             (w_data_wr_rrg2ope), 
    .ov_ptp_messagetype                    (wv_ptp_messagetype_rrg2ope),	
	.ov_port_id                            (wv_osm_id_rrg2ope ),
    .o_first_byte_valid                    (w_first_byte_valid_rrg2ope),
	 
	.iv_t2_p0                              (wv_t2_p0_rtr2rrg ),	
	.iv_t2_p1                              (wv_t2_p1_rtr2rrg ),
	.iv_t2_p2                              (wv_t2_p2_rtr2rrg ),
	.iv_t2_p3                              (wv_t2_p3_rtr2rrg ),
	.iv_t2_p4                              (wv_t2_p4_rtr2rrg ),
	.iv_t2_p5                              (wv_t2_p5_rtr2rrg ),
	.iv_t2_p6                              (wv_t2_p6_rtr2rrg ),
	.iv_t2_p7                              (wv_t2_p7_rtr2rrg ),
	.iv_t2_p8                              (wv_t2_p8_rtr2rrg ),
	.iv_t2_p9                              (wv_t2_p9_rtr2rrg ),
	.iv_t2_p10                             (wv_t2_p10_rtr2rrg) ,	
	.iv_t2_p11                             (wv_t2_p11_rtr2rrg) ,
	.iv_t2_p12                             (wv_t2_p12_rtr2rrg) ,
	.iv_t2_p13                             (wv_t2_p13_rtr2rrg) ,
	.iv_t2_p14                             (wv_t2_p14_rtr2rrg) ,
	.iv_t2_p15                             (wv_t2_p15_rtr2rrg) ,
	.iv_t2_p16                             (wv_t2_p16_rtr2rrg) ,
	.iv_t2_p17                             (wv_t2_p17_rtr2rrg) ,
	.iv_t2_p18                             (wv_t2_p18_rtr2rrg) ,
	.iv_t2_p19                             (wv_t2_p19_rtr2rrg) ,
	.iv_t2_p20                             (wv_t2_p20_rtr2rrg) ,
	.iv_t2_p21                             (wv_t2_p21_rtr2rrg) ,
	.iv_t2_p22                             (wv_t2_p22_rtr2rrg) ,
	.iv_t2_p23                             (wv_t2_p23_rtr2rrg) ,
	.iv_t2_p24                             (wv_t2_p24_rtr2rrg) ,
	.iv_t2_p25                             (wv_t2_p25_rtr2rrg) ,
	.iv_t2_p26                             (wv_t2_p26_rtr2rrg) ,
	.iv_t2_p27                             (wv_t2_p27_rtr2rrg) ,
	.iv_t2_p28                             (wv_t2_p28_rtr2rrg) ,
	.iv_t2_p29                             (wv_t2_p29_rtr2rrg) ,
	.iv_t2_p30                             (wv_t2_p30_rtr2rrg) ,
    .iv_t2_p31                             (wv_t2_p31_rtr2rrg) ,
 
	.iv_t3                                 (wv_t3_rtr2rrg    ) ,
	.i_t3_wr                               (w_t3_wr_rtr2rrg  )
);

opensync_protocol_encapsulate #(.osm_id(8'd0),.local_module_id(local_module_id))opensync_protocol_encapsulate_mrq
(
        .i_clk              (i_clk            ),
        .i_rst_n            (i_rst_n          ),
        
        .iv_hcp_mid               (iv_hcp_mid               ),
        .iv_opensync_dst_module_id({4'b0,wv_osm_id_rrg2ope} + 1'b1),
        
        .iv_data            (wv_data_rrg2ope       ),
        .i_data_wr          (w_data_wr_rrg2ope     ),
		//.iv_osm_id          (wv_osm_id_rrg2ope     ),
		.iv_eth_type        (16'h88f7    ),
		.iv_ptp_messagetype (wv_ptp_messagetype_rrg2ope        ),
        .iv_local_count_rx  (24'h0       ),
        .i_diagest_wr       (w_first_byte_valid_rrg2ope        ),
                            
        .ov_data            (ov_data    ),
        .o_data_wr          (o_data_wr  )
);              
endmodule